DINGO backup

This service is used to configure and manage the backup of the DINGO databases.

The backup-service can be installed on the "Services" tab within the DINGO-Manager. The backup-service can also be installed from a SSH terminal with this command: sudo sh -c "$(curl -s http://apps.control2net.com/apt/install-dingo-backup)"

If the service does not exist, then create it with the properties, described below.

Configuration

To configure the backup-service ; select the backup-service and click the "Main config. file..." button. See screenshot.

The only configuration necessary is the FTP setup (username, password, server and directory). All other configuration properties are good with their default values.

The configuration items are:

  • backup_dir: This is the directory where the backup-file will be written to. /dev/shm/ is a directory mounted into memory, so the file will not be written to disk. This solution is used, because the backup-file will be transferred to a remote server, after creation and not stored locally.
  • backup_dingo_stack_database: This property can be true or false and determines if a backup should be taken of the DINGO-Stack database.

  • backup_file: This is the name, that the backup-file of the DINGO-Stack database will get.
  • backup_url: This is the web-service URL, that will generate the backup of the DINGO-Stack database. It is used with a PUT request. This property should not be changed.
  • backup_lorawan_server_database: This property can be true or false and determines if a backup should be taken of the DINGO LoRaWAN Server database.
  • lorawan_backup_file: This is the name, that the backup-file of the DINGO LoRaWAN Server database will get.
  • lorawan_backup_url: This is the web-service URL, that will generate the backup of the DINGO LoRaWAN Server database. It is used with a PUT request. This property should not be changed.
  • backup_rotations: If a backup rotation of 2 is used, then the first backup-file will get ".1" appended to the name. The second backup will get ".2" appended to the name. And the third will get ".1" appended again - and so the rotation will go in circles. This means that there will be 2 backup-files, where one will be newer than the other. If no backup rotation is used, then nothing will be appended to the backup-file and there will be only one backup-file.
  • use_compression: If compression is used, then the backup-file will be compressed and ".tar.gz" will be appended to the backup-file name.
  • ftp_username: This is the username used, when uploading the backup-file to the remote FTP server.
  • ftp_password: This is the passsword used, when uploading the backup-file to the remote FTP server.
  • ftp_server: This is the IP address of the remote FTP server.
  • ftp_dir: Directory on the remote FTP server, that the backup-file should be uploaded to.

Any changes to the configuration file will take immediate effect.

This is the standard content of the configuration file:

# The location where the backup is placed:
backup_dir="/dev/shm/"
# Determines if backup should be taken of the DINGO-Stack database:
backup_dingo_stack_database=true
# Name given to the backup of the DINGO-Stack database:
backup_file="DinGo.db"
# The web-service call to backup the DINGO-Stack database:
backup_url="http://localhost/bacnetws/dingo-system/backup-database?alt=json"
# Determines if backup should be taken of the DINGO-LoRaWAN-Server database:
backup_lorawan_server_database=true
# Name given to the backup of the DINGO-LoRaWAN-Server database:
lorawan_backup_file="dingo-lorawan-server.db"
# The web-service call to backup the DINGO-LoRaWAN-Server database:
lorawan_backup_url="http://localhost/bacnetws/dingo-system/backup-dingo-lorawan-server-database?alt=json"
# The number of backup rotations:
backup_rotations=0
# Determines if the backup file should be compressed before upload:
use_compression=true
# FTP settings:
# Contact Go-IoT to get a username, password and FTP-directory on Go-IoT´s FTP server.
upload_to_ftp=true
ftp_username="your_username"
ftp_password="your_password"
ftp_server="82.221.35.195"
ftp_dir="/SiteBackups/CustomerDir"

 

Contact Go-IoT to get a username, password and FTP-directory on Go-IoT's FTP server.

Crontab configuration (scheduled backup)

The frequency of the backup-service is defined by the crontab service. Add this entry to the cron-table (crontab), to do the backup daily, at 6:15 AM:

15 6 * * * root /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.sh

FTP Alternative

The backup-service is a shell-script that will take a backup of the DINGO databases and upload the backup to a FTP server.

If there is a need to use something else than FTP, then the script can be edited to use something else. This is of course for advanced users.

Connect to the DINGO device via SSH terminal ( e.g. https://www.putty.org/) and follow these instructions:

  1. sudo nano /opt/GoIoT/DinGo/bin/general/rn_dingo_backup_and_upload.sh
  2. At the top of the file, there is a function that contains the FTP code. Here the necessary changes can be made:

    ...
    # This function takes one parameter, the name file that should be uploaded via FTP
    function uploadToFTP()
    {
    ftp -n $ftp_server <<END_SCRIPT
    quote USER $ftp_username
    quote PASS $ftp_password
    binary
    cd $ftp_dir
    put $backup_dir$1 $HOSTNAME.$1
    quit
    END_SCRIPT
    }
    ...
  3. CTRL + X to close, hit Y to save changes.